/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __LASER_H
#define __LASER_H

#include "usart.h"

#define la_voltage								0x0006
#define set_led										0x01BE
#define set_offset								0x0012
#define get_sign_high_num					0x0020

#define HEX_DIGIT_1(x) (((x) >> 12) & 0xF)
#define HEX_DIGIT_2(x) (((x) >> 8) & 0xF)
#define HEX_DIGIT_3(x) (((x) >> 4) & 0xF)
#define HEX_DIGIT_4(x) ((x) & 0xF)

// 将四位十六进制数字转换为"数字字面量"
#define HEX_TO_DECIMAL(x) ( \
    (HEX_DIGIT_1(x) * 1000) + \
    (HEX_DIGIT_2(x) * 100) + \
    (HEX_DIGIT_3(x) * 10) + \
    HEX_DIGIT_4(x) \
)

void laser_init(void);
void laser_tx_cmd(uint16_t tx_cmd);
void laser_write_data(uint16_t tx_cmd, uint16_t data);

extern float laser_dis;
#endif /* laser.h */

/******************* (H) COPYRIGHT 2025 FUYEBING*****END OF FILE************/

